﻿using System;
using System.Web;
using System.Collections;
using System.Web.Services;
using System.Web.Services.Protocols;
using Dcms.BLL;

namespace WebApp.AppCode
{
    /// <summary>
    /// AddBaseCate 的摘要说明
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    public class AddBaseCate
    {
        public AddBaseCate()
        {

            //如果使用设计的组件，请取消注释以下行 
            //InitializeComponent(); 
        }

        [WebMethod]
        public bool EditNewCate(string cateStr)
        {
            try
            {
                if (cateStr != "")
                {
                    Dcms_ModelFieldBLL model = new Dcms_ModelFieldBLL();
                    EntirelyBLL entir = new EntirelyBLL();
                    string strSql = "delete from Dcms_ModelField  where";
                    string[] ModelArr = cateStr.Split(',');

                    for (int i = 0; i < ModelArr.Length; i++)
                    {
                        if (ModelArr[i] == "Introduction")
                        {
                            ModelArr[i] = "INTOR";
                        }
                        if (model.GetModelListByModelAndModelKeyID(ModelArr[i], 0).Count == 0)
                        {
                            model.CopyDefaultModelByModel(ModelArr[i], 0);
                        }

                        strSql = strSql + " mf_Model <>'" + ModelArr[i] + "' and";
                    }
                    strSql = strSql.Substring(0, strSql.Length - 3);
                    entir.ExecuteSqlStr(strSql);



                }
                return true;
            }
            catch (Exception ex)
            {
                return false;
            }

        }
    }
}